#include<stdio.h>
int main()
{
	int m,s;
	float t,c;
	scanf("%d %d",&m,&s);
	t=m+s/60.0;
	if(0<=t&&t<=10) printf("%.1f",100-5*t);
	else if(t<=30) printf("%.1f",60-t);
	else if(t<=50) printf("%.1f",45-t/2.0);
	else printf("20.0");
	return 0;
}
